<?php
class MySQL
{
	var $conn ;
	
	function MySQL()
	{
		include "../system/application/config/database.php";
		$host		= "localhost";
		$username	= $db['default']['username'] ;
		$password	= $db['default']['password'] ;
		$databasename= $db['default']['database'] ;
		$dir = getcwd() ;
		if (!isset($db['default']['username'])) 
			die ("config file of CodeIgniter not found $dir");
		$this->conn = mysql_connect($host,$username,$password)
		or die('Could not connect: ' . mysql_error());
		mysql_select_db($databasename) or die('Could not select database');
	}

	function getHostList()
	{
		$arr = array() ;
		$query = 'SELECT * FROM client';
		$result = mysql_query($query) or die('Query failed: ' . mysql_error());
		$i = 0;
		while($row = mysql_fetch_array($result,MYSQL_ASSOC))
			$arr[$i++] = $row ;
		return $arr ;
	}
	
	function execute($query) 
	{
		$affectedRow = 0 ;
		$result = mysql_query($query) ;
		
		return $result; 
	}
	
}
/*
$sql = new MySQL() ;

$arr = $sql->getHostList() ;
foreach( $arr as $host)
	print_r ($host) ;
*/
?>